using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMoveState : PlayerGroundState
{
    public PlayerMoveState(Player _player, PlayerStateMachine _stateMachine, string _animBoolName) : base(_player, _stateMachine, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        AudioManger.instance.PlaySFX(6, null);
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void update()
    {
        base.update();
      
        player.SetVelocity(xInput*player.moveSpeed, player.rb.velocity.y);
        if ((xInput==0 || player.IsWallDected()||Input.GetKeyDown(KeyCode.P)))
        {
            player.stateMachine.ChangeState(player.idleState);
        }
    }
}
